//
//  KABMallModel.h
//  kabu
//
//  Created by XiangDongMBP on 2017/2/10.
//  Copyright © 2017年 East. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <YYModel.h>

#pragma mark - 商城首页
@interface KABMallHpListItem : NSObject<NSCoding>
@property (nonatomic, assign) NSInteger hpId;           // 编号
@property (nonatomic, copy)   NSString *title;          // 标题
@property (nonatomic, copy)   NSString *subtitle;       // 副标题
@property (nonatomic, copy)   NSString *cover_img_url;  // 封面图片
@property (nonatomic, copy)   NSString *link_url;       // 跳转链接
@property (nonatomic, assign) NSInteger link_type;      // 跳转链接类型
@property (nonatomic, assign) NSInteger type_id;        // 分类
@end

@interface KABMallHpItem : NSObject<NSCoding>
@property (nonatomic, assign) NSInteger typeId;       //!< 分类
@property (nonatomic, copy)   NSString *icon_url;     //!< 分类小图标
@property (nonatomic, copy)   NSString *content;      //!< 分类内容
@property (nonatomic, strong) NSMutableArray<KABMallHpListItem *> *list;
@end

@interface KABMallHomepage : NSObject<NSCoding>
@property (nonatomic, strong) NSMutableArray<KABMallHpItem *> *homepage_list;
@end

#pragma mark - 商城Banner
@interface KABMallBannerItem : NSObject<NSCoding>
@property (nonatomic, assign) NSInteger bannerId;          //!< @"id"----@"bannerId" 商品id
@property (nonatomic, assign) NSInteger order_number;       //!< 隶属商铺id
@property (nonatomic, copy)   NSString *image_url;          //!< 商品名称
@property (nonatomic, copy)   NSString *link_url;           //!< 商铺名称
@end
@interface KABMallBannerList : NSObject<NSCoding>
@property (nonatomic, assign) NSInteger total_rows;
@property (nonatomic, strong) NSMutableArray<KABMallBannerItem *> *banner_list;

- (NSArray<NSString *> *)bannerImgUrlArray;
@end


#pragma mark - 商品列表
@interface KABMallProListItem : NSObject<NSCoding>
@property (nonatomic, assign) NSInteger productId;          //!< @"id"----@"productId" 商品id
@property (nonatomic, assign) NSInteger shop_id;            //!< 隶属商铺id
@property (nonatomic, copy)   NSString *name;               //!< 商品名称
@property (nonatomic, copy)   NSString *shop_name;          //!< 商铺名称
@property (nonatomic, assign) NSInteger original_price;     //!< 原价
@property (nonatomic, assign) NSInteger discounted_price;   //!< 折后价
@property (nonatomic, copy)   NSString *cover_image_url;    //!< 封面图片地址
@property (nonatomic, assign) BOOL is_buyable;              //!< 是否可以购买，0-否 1-是
@end

@interface KABMallProductList : NSObject<NSCoding>
@property (nonatomic, assign) NSInteger total_rows;
@property (nonatomic, strong) NSMutableArray<KABMallProListItem *> *product_list;

@property (nonatomic, readonly) BOOL totalLoad;
- (void)addMoreWithData:(KABMallProductList *)temp;
@end


#pragma mark - 商品详情
// 商品属性下的型号Item
@interface KABProModelListItem : NSObject
@property (nonatomic, assign) NSInteger model_id;           //!< @"id"----@"model_id" 型号id
@property (nonatomic, copy)   NSString *content;            //!< 型号内容
@property (nonatomic, copy)   NSString *display_image_url;  //!< 暂时不用(属性图片)

//@property (nonatomic, assign) NSInteger display_order;      //!< 展示的顺序(以下属性已去掉)
//@property (nonatomic, assign) NSInteger original_price;     //!< 附加原价
//@property (nonatomic, assign) NSInteger discounted_price;   //!< 附加折后价
//@property (nonatomic, assign) NSInteger count;              //!< 总量
//@property (nonatomic, assign) NSInteger stock;              //!< 库存
@end

// 商品属性Item
@interface KABProductProItem : NSObject
@property (nonatomic, assign) NSInteger property_id;            //!< 属性id
@property (nonatomic, copy)   NSString *property_content;       //!< @"content"--@"property_content" 属性描述
@property (nonatomic, strong) NSMutableArray<KABProModelListItem *> *model_list;    //!< 属性列表

// 添加到购物车时，需要用到的属性
@property (nonatomic, assign) NSInteger model_id;               //!< 型号id
@end

// 商品库存Item
@interface KABProSkuListItem : NSObject
@property (nonatomic, copy)   NSString *sku_id;             //!< 型号组合id，productid_propertyid:modelid_...(购物车为 product_sku_id)
@property (nonatomic, assign) NSInteger stock;              //!< 库存
@property (nonatomic, assign) NSInteger original_price;     //!< 原价
@property (nonatomic, assign) NSInteger discounted_price;   //!< 优惠价
@end

// 商品Banner的图片 or 商品详情的图片
@interface KABProDetailImgItem : NSObject
@property (nonatomic, assign) NSInteger detImgId;           //!< @"id"----@"detImgId"  编号
@property (nonatomic, assign) NSInteger display_order;      //!< 展示序号
@property (nonatomic, copy)   NSString *image_url;          //!< 图片链接
@end

// 商品详情
@interface KABMallProDetail : NSObject<YYModel>
@property (nonatomic, assign) NSInteger product_id;         //!< @"id"----@"product_id" 商品id
@property (nonatomic, assign) NSInteger shop_id;            //!< 隶属商铺id
@property (nonatomic, copy)   NSString *product_name;       //!< @"name"---@"product_name" 商品名称
@property (nonatomic, assign) NSInteger shop_owner_id;      //!< 店主id
@property (nonatomic, copy)   NSString *shop_name;          //!< 商铺名称
@property (nonatomic, copy)   NSString *shop_owner;         //!< 店铺主人名称
@property (nonatomic, copy)   NSString *shop_owner_sign;    //!< 店铺主人签名
@property (nonatomic, copy)   NSString *shop_ower_head_image_url;  //!< 店铺主人头像
@property (nonatomic, assign) NSInteger freight;            //!< 运费
@property (nonatomic, copy)   NSString *introduce;          //!< 商品介绍
@property (nonatomic, copy)   NSString *product_cover_image_url;//!< @"cover_image_url"--@"product_cover_image_url" 封面图片地址
@property (nonatomic, assign) BOOL is_buyable;              //!< 是否可以购买，0-否 1-是
@property (nonatomic, assign) NSInteger original_price;     //!< 原价
@property (nonatomic, assign) NSInteger discounted_price;   //!< 优惠价
@property (nonatomic, assign) NSInteger total_collected;    //!< 总收藏数
@property (nonatomic, assign) BOOL is_collected;            //!< 是否被收藏，0-否 1-是
@property (nonatomic, copy)   NSString *total_product_property;                             //!< 总商品类型
@property (nonatomic, strong) NSMutableArray<KABProductProItem *> *product_property_list;   //!< 商品类型列表
@property (nonatomic, strong) NSMutableArray<KABProSkuListItem *> *sku_list;                //!< 库存组合
@property (nonatomic, strong) NSMutableArray<KABProDetailImgItem *> *detail_image_list;     //!< Banner的图片组合
@property (nonatomic, strong) NSMutableArray<KABProDetailImgItem *> *introduce_image_list;  //!< 详情图片组合

// 添加到购物车时，需要用到的属性
@property (nonatomic, assign) NSInteger number;             //!< 数量
@property (nonatomic, assign) NSInteger type_id;            //!< 类型
@property (nonatomic, assign) NSInteger shoppingcart_id;    //!< @"id"----@"shoppingcart_id" 购物车项id
@property (nonatomic, copy)   NSString *product_sku_id;     //!< 型号组合id

@property (nonatomic, assign) BOOL isSelected;              //!< 是否选中

// 已选中的属性的字符串
@property (nonatomic, readonly) NSString *selPropertyStr;   //!< 已选中商品的属性
@property (nonatomic, readonly) NSInteger selOriginalPrice; //!< 已选中商品属性的价格
@property (nonatomic, readonly) NSInteger selStock;         //!< 已选中商品属性的数量
@property (nonatomic, readonly) NSString *selSkuId;         //!< 已选中的商品组合ID
@property (nonatomic, readonly) BOOL hasSelModel;           //!< 用户是否已经选择

// 图片展示用的数组
@property (nonatomic, readonly) NSArray<NSString *> *bannerImgUrlArray;

- (void)skuIdTransToModelId;        //!< SkuID 转 ModelID
- (void)modelIdMergeToSkuId;        //!< ModelID 合并为 SkuID

@end

#pragma mark - 购物车
//@interface KABMallShoCarProItem : NSObject
//@property (nonatomic, assign) NSInteger property_id;        //!< 属性id
//@property (nonatomic, copy)   NSString *property_content;   //!< 属性描述
//@property (nonatomic, assign) NSInteger model_id;           //!< 型号id
//@property (nonatomic, copy)   NSString *model_content;      //!< 型号内容
//@property (nonatomic, assign) NSInteger original_price;     //!< 原价
//@property (nonatomic, assign) NSInteger discounted_price;   //!< 优惠价
//@property (nonatomic, assign) NSInteger count;              //!< 总量
//@property (nonatomic, assign) NSInteger stock;              //!< 库存
//@property (nonatomic, strong) NSMutableArray<KABProModelListItem *> *model_list;    //!< 属性列表
//@end
//
//@interface KABMallShopCartItem : NSObject
//@property (nonatomic, assign) NSInteger shoppingcart_id;    //!< @"id"----@"shoppingcart_id" 购物车项id
//@property (nonatomic, assign) NSInteger product_id;         //!< 商品id
//@property (nonatomic, copy)   NSString *product_name;       //!< 商品名称
//@property (nonatomic, copy)   NSString *product_cover_image_url;    //!< 封面图片地址
//@property (nonatomic, assign) NSInteger shop_id;            //!< 隶属商铺id
//@property (nonatomic, copy)   NSString *shop_name;          //!< 商铺名称
//@property (nonatomic, assign) NSInteger original_price;     //!< 原价
//@property (nonatomic, assign) NSInteger discounted_price;   //!< 优惠价
//@property (nonatomic, assign) NSInteger number;             //!< 数量
//@property (nonatomic, assign) NSInteger type_id;            //!< 类型
//@property (nonatomic, strong) NSMutableArray<KABMallShoCarProItem *> *product_property_list;   //!< 商品类型列表
//@end

@interface KABMallShopCartModel : NSObject
@property (nonatomic, assign) NSInteger total_rows;         //!< 数据总量
//@property (nonatomic, strong) NSArray<KABMallShopCartItem *> *product_list;
@property (nonatomic, strong) NSMutableArray<KABMallProDetail *> *product_list; //!< 修改了数据模型，复用商品详情的Model
@property (nonatomic, strong) NSArray<NSArray<KABMallProDetail *> *> *sortList; //!< 整理后的数据

@property (nonatomic, readonly) NSInteger selProductCnt;    //!< 已选择购物车的选项
@property (nonatomic, readonly) NSInteger wholeSelOriginalPrice;//!< 所有选择的价格(不包含运费)
@property (nonatomic, readonly) NSInteger wholeSelTotalPrice;   //!< 所有选择的价格(包含运费)
- (void)sortWithSameShop;
- (void)transSkuIdToModelId;    // 购物车返回的时候没有ModelID
- (BOOL)isWholeSelectedWithIndex:(NSInteger)index;
- (void)setWholeSelected:(BOOL)isSel withIndex:(NSInteger)index;
- (BOOL)isWholeSelected;
- (void)setWholeSelected:(BOOL)isSel;
- (NSInteger)originalPriceWithIndex:(NSInteger)index;
- (NSInteger)freightWithIndex:(NSInteger)index;
- (NSInteger)totalPriceWithIndex:(NSInteger)index;
- (NSInteger)totalProductCntWithIndex:(NSInteger)index;
- (NSAttributedString *)desAttributeStrWithIndex:(NSInteger)index;  //!< 确认订单界面用到的字符串
- (NSArray<KABMallProDetail *>*)selectProductArray;
- (NSArray<NSNumber *> *)selectShoppingcartIdArray;
- (void)deleteSelectProduct;
//- (NSArray *)editOrderJson;
- (NSArray *)submitOrderJsonWithReceiverId:(NSInteger)recItemId;
@end

#pragma mark - 订单详情
@interface KABMallOrdPropertyItem : NSObject
@property (nonatomic, copy)   NSString *property_content;     //!< 属性内容
@property (nonatomic, copy)   NSString *model_content;        //!< 型号内容
@property (nonatomic, copy)   NSString *display_image_url;    //!< 该型号的展示图片
@end

@interface KABMallOrdProductItem : NSObject
@property (nonatomic, copy)   NSString *product_name;               //!< 商品名称
@property (nonatomic, copy)   NSString *product_cover_image_url;    //!< 商品小图片
@property (nonatomic, strong) NSArray<KABMallOrdPropertyItem *> *property_list;
@property (nonatomic, assign) NSInteger number;                     //!< 购买数量
@property (nonatomic, assign) NSInteger original_price;             //!< 原始价格
@property (nonatomic, assign) NSInteger discounted_price;           //!< 优惠价

// 订单列表才有的属性
@property (nonatomic, copy)   NSString *product_property;           //!<  商品属性

@end

@interface KABMallOrderDetail : NSObject
@property (nonatomic, copy)   NSString *order_id;       //!< 订单号
@property (nonatomic, copy)   NSString *logistic_code;  //!< 快递单号
@property (nonatomic, assign) NSInteger order_type;     //!< 订单状态：0-全部订单 1-待付款 2-待发货 3-待收货 4-已完成 5-退货
@property (nonatomic, strong) NSArray<KABMallOrdProductItem *> *product_list;
@property (nonatomic, assign) NSInteger freight;         //!< 运费
@property (nonatomic, assign) NSInteger total_price;    //!< 总价
@property (nonatomic, copy)   NSString *create_time;    //!< 订单生成时间
@property (nonatomic, copy)   NSString *wx_transaction_id;//!< 微信交易单号
@property (nonatomic, copy)   NSString *dead_time;      //!< 订单无效时间
@property (nonatomic, assign) NSInteger receiver_id;    //!< 收货人
@property (nonatomic, copy)   NSString *receiver_name;  //!< 收货人
@property (nonatomic, copy)   NSString *receiver_phone; //!< 收货人联系电话
@property (nonatomic, copy)   NSString *receiver_address;   //!< 收货地址
@property (nonatomic, assign) NSInteger shop_id;            //!< 隶属商铺id
@property (nonatomic, copy)   NSString *shop_name;          //!< 商铺名称
@property (nonatomic, assign) NSInteger shop_owner_id;      //!< 店主id
@property (nonatomic, assign) NSInteger user_id;            //!< 用户ID
@property (nonatomic, copy)   NSString *product_name;       //!< @"name"---@"product_name" 商品名称
@property (nonatomic, copy)   NSString *shop_owner;         //!< 店铺主人名称
@property (nonatomic, copy)   NSString *shop_owner_sign;    //!< 店铺主人签名
@property (nonatomic, copy)   NSString *shop_ower_head_image_url;  //!< 店铺主人头像

// 退货相关
@property (nonatomic, copy)   NSString *refund_start_time;      //!< 退货开始时间
@property (nonatomic, copy)   NSString *refund_end_time;        //!< 退货完成时间
@property (nonatomic, copy)   NSString *refund_reason;          //!< 申请退货原因
@property (nonatomic, assign) NSInteger refund_state;           //!< 退货状态 0-申请，1-确定退货，2-拒绝退货

//
@property (nonatomic, readonly) NSInteger total_number; //!< 商品的总数量

@end

#pragma mark - 购物车

#pragma mark - 订单列表
@interface KABMallOrderList : NSObject
@property (nonatomic, assign) NSInteger total_rows;
@property (nonatomic, strong) NSMutableArray<KABMallOrderDetail *> *order_list;

@property (nonatomic, readonly) BOOL totalLoad;
- (void)addMoreWithData:(KABMallOrderList *)temp;
@end


#pragma mark - 提交订单返回的模型
@interface KABMallSubOrdBackDetail : NSObject
@property (nonatomic, copy)   NSString *out_trade_no;           //!< 总的查询单号
@property (nonatomic, assign) NSInteger total_rows;
@property (nonatomic, strong) NSArray<NSString *> *order_list;
@end

@interface KABMallWxPayPars : NSObject
@property (nonatomic, copy) NSString *partnerId;/** 商家向财付通申请的商家id */
@property (nonatomic, copy) NSString *prepayId; /** 预支付订单 */
@property (nonatomic, copy) NSString *nonceStr; /** 随机串，防重发 */
@property (nonatomic, assign) UInt32 timeStamp; /** 时间戳，防重发 */
@property (nonatomic, copy) NSString *package;  /** 商家根据财付通文档填写的数据和签名 */
@property (nonatomic, copy) NSString *sign;     /** 商家根据微信开放平台文档对数据做的签名 */
@end

@interface KABMallSubOrdBackModel : NSObject
@property (nonatomic, strong) KABMallSubOrdBackDetail *order_detail;
@property (nonatomic, strong) KABMallWxPayPars *wx_pay;

// 单独调用wx_pay接口时，交易单号放在这里
@property (nonatomic, copy)   NSString *out_trade_no;           //!< 总的查询单号
// 展会购买成功使用到的参数
@property (nonatomic, copy)   NSString *order_id;   //!< 展会ID
@end

#pragma mark - 暂时无用
@interface KABMallModel : NSObject

@end


#pragma mark - 商品分类
@interface KABMallProSubTyepItem : NSObject<NSCoding>
@property (nonatomic, assign) NSInteger subTypeId;       //!< @"id"--@"subTypeId" 编号
@property (nonatomic, copy)   NSString *content;         //!< 商品二级分类内容
@property (nonatomic, copy)   NSString *display_img_url; //!< 类型展示图片
@end

@interface KABMallProShopListItem : NSObject<NSCoding>
@property (nonatomic, assign) NSInteger shop_id;             //!< 店铺id
@property (nonatomic, copy)   NSString *shop_name;           //!< 店铺名称
@property (nonatomic, assign) NSInteger shop_owner_id;       //!< 店主id
@property (nonatomic, copy)   NSString *shop_background_url; //!< 店铺背景图片
@end

@interface KABMallProTypeItem : NSObject<NSCoding>
@property (nonatomic, assign) NSInteger typeId;         //!< @"id"--@"typeId" 编号
@property (nonatomic, copy)   NSString *content;        //!< 一级分类内容
@property (nonatomic, strong) NSArray<KABMallProSubTyepItem *> *product_subtype_list;

@property (nonatomic, assign) NSInteger total_rows;     //!< 店铺总数
@property (nonatomic, strong) NSMutableArray<KABMallProShopListItem *> *shop_list;//!< 店铺列表

@property (nonatomic, readonly) BOOL totalLoad;
- (void)addMoreWithData:(KABMallProTypeItem *)temp;
- (void)refreshWithData:(KABMallProTypeItem *)temp;
- (KABMallProTypeItem *)proTypeItemWithDictionary:(NSDictionary *)dic isAddMore:(BOOL)addMore;
@end

@interface KABMallProductType : NSObject<NSCoding>
@property (nonatomic, assign) NSInteger total_rows;
@property (nonatomic, strong) NSMutableArray<KABMallProTypeItem *> *product_type_list;
@end


#pragma mark - 店铺详情
// 商品Banner的图片 or 商品详情的图片
@interface KABMallShopBannerItem : NSObject
@property (nonatomic, assign) NSInteger bannerId;           //!< @"id"----@"detImgId"  编号
@property (nonatomic, assign) NSInteger order_number;       //!< 展示序号
@property (nonatomic, copy)   NSString *image_url;          //!< 图片链接
@end

@interface KABMallShopDetInfo : NSObject
@property (nonatomic, assign) NSInteger shop_id;            //!< 隶属商铺id
@property (nonatomic, assign) BOOL is_collected;            //!< 是否被收藏，0-否 1-是
@property (nonatomic, copy)   NSString *shop_name;          //!< 商铺名称
@property (nonatomic, assign) NSInteger shop_owner_id;      //!< 店主id
@property (nonatomic, copy)   NSString *shop_owner_name;    //!< 店铺主人名称
@property (nonatomic, copy)   NSString *shop_owner_imgurl;  //!< 店铺主人头像
@property (nonatomic, copy)   NSString *shop_owner_phone_number;    //!< 店主联系方式
@property (nonatomic, copy)   NSString *shop_sign;          //!< 店主签名
@property (nonatomic, copy)   NSString *shop_head_imgurl;   //!< 店铺的头像(需要后台上传)
@property (nonatomic, copy)   NSString *shop_background_url;//!< 店铺背景图片
@property (nonatomic, strong) NSMutableArray<KABMallShopBannerItem *> *shop_banner;//!< Banner
@end

@interface KABMallShopDetail : NSObject
@property (nonatomic, strong) KABMallShopDetInfo *shop_detail;
@property (nonatomic, assign) NSInteger total_rows;
@property (nonatomic, strong) NSMutableArray<KABMallProListItem *> *product_list;

@property (nonatomic, readonly) BOOL totalLoad;
- (void)addMoreWithData:(KABMallShopDetail *)temp;
@end


#pragma mark - 收藏的店铺列表
@interface KABMallShopColList : NSObject
@property (nonatomic, assign) NSInteger total_rows;
@property (nonatomic, strong) NSMutableArray<KABMallShopDetInfo *> *shop_list;

@property (nonatomic, readonly) BOOL totalLoad;
- (void)addMoreWithData:(KABMallShopColList *)temp;
@end


#pragma mark - 物流信息
@interface KABMallLogisticItem : NSObject
@property (nonatomic, copy)   NSString *accept_station;     //!< 状态
@property (nonatomic, copy)   NSString *accept_time;        //!< 时间
@end

@interface KABMallLogisticInfo : NSObject
@property (nonatomic, copy)   NSString *logistic_code;    //!< 物流单号
@property (nonatomic, strong) NSMutableArray<KABMallLogisticItem *> *traces;
@end
